#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h> 
#include <stdlib.h> 
#include <string.h> 
#include <math.h> 
#include <ctype.h> 
#include <time.h> 
#include <assert.h>

int main()
{
	int len1 = 0;
	scanf("%d", &len1);
	getchar();

	char* str1 = (char*)malloc((len1 + 1) * sizeof(char));
	for (int i = 0; i < len1; i++)
	{
		str1[i] = getchar();
	}
	getchar();
	str1[len1] = '\0';

	int len2 = 0;
	scanf("%d", &len2);
	getchar();

	char* str2 = (char*)malloc((len2 + 1) * sizeof(char));
	for (int i = 0; i < len2; i++)
	{
		str2[i] = getchar();
	}
	getchar();
	str2[len2] = '\0';

	int find = 0;
	for (int i = 0; i <= len1 - len2; i++)
	{
		int match = 1;
		for (int j = 0; j < len2; j++)
		{
			if (str1[i + j] != str2[j])
			{
				match = 0;
				break;

			}
		}
		if (match)
		{
			printf("%d\n", i);
			find = 1;
		}
	}

	if (!find)
		printf("-1\n");

	free(str1);
	free(str2);
	return 0;
}